7.3 EMP_result
The module EMP_result
can extract the data analysis results in the analysis workflow, and can import the external data analysis results that meet the format requirements into the objects and combine them for data analysis.
7.3.1 Extraction of data analysis results
When multiple data analyses are performed in the workflow, the results are stored in the object. The module EMP_result
can quickly extract the original results.
result <- MAE |>
EMP_assay_extract('geno_ec') |>
EMP_alpha_analysis() |>
EMP_diff_analysis(method = 'DESeq2',.formula = ~Group) |>
EMP_enrich_analysis(pvalue<0.05,keyType='ec',pvalueCutoff=0.05)
diff_re <- result |> EMP_result(info = 'EMP_diff_analysis')
alpha_re <- result |> EMP_result(info = 'EMP_alpha_analysis')
enrich_re <- result |> EMP_result(info = 'EMP_enrich_analysis')
7.3.2 Injection of data analysis results
It is challenging to include all data analysis and processing methods within a single R package. Therefore, the module EMP_result
allows importing results from external software analyses into the EMPT object, enabling integration with the analysis results in EasyMultiProfiler for more comprehensive joint analysis.
🏷️Example:Users can import the results from the external vegan
package to calculate diversity into the EMPT
object.
Step 1: Extract the species data of the microorganisms.
tax_se <- MAE |>
EMP_assay_extract('taxonomy')
assay_data <- tax_se |>
EMP_assay_extract(action = 'get')
Step 2: The Shannon diversity index was calculated using the vegan
package and named new_shannon
.
assay_data <- assay_data |> tibble::column_to_rownames('primary')
shannon_index <- vegan::diversity(assay_data,index = 'shannon')
new_result <- tibble::tibble(primary=names(shannon_index),new_shannon=shannon_index)
new_result
The name in the new result must be unique and not duplicate any existing names in the data results; otherwise, the function
EMP_filter
will not work correctly. For example, in this case, you need to rename the Shannon
index from an external result to new_shannon
to avoid conflicts with the result name from EMP_alpha_analysis
.
### inject the new result into EMPT object
EMP_result(tax_se,
value_name = 'new_alpha',
affect_when_sample_changed=0,
affect_when_feature_changed=1,
attribute='primary',
attribute2='normal',source='user_import') <- new_result
tax_se |>
EMP_filter(sample_condition = new_shannon >4)